package com.interview.dao;

import com.interview.pojo.Comment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface CommentMapper extends Mapper<Comment> {


//查询一级评论
    @Select("select * from comment where their=#{their} and reply_id='null' ORDER  BY time DESC")
    List<Comment> comment_select(@Param("their") String their );

    //查询指定评论下的回复
    @Select("select * from comment where their=#{their} and reply_id=#{reply_id} ORDER  BY time DESC")
    List<Comment> comment_select_son(@Param("their") String their , @Param("reply_id")  String reply_id);


    @Select("select count(*) from comment")
    int count();

}
